package com.itheima.delaytask.feign;

import com.itheima.delaytask.dto.Task;
import com.itheima.delaytask.feign.fallbackfactory.TaskServiceFallbackFactory;
import com.itheima.response.ResponseMessage;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * Created by 传智播客*黑马程序员.
 */
@FeignClient(name = "delay-task-service",fallbackFactory = TaskServiceFallbackFactory.class)
public interface TaskService {
    
    @PostMapping("/task/push")
    public ResponseMessage push(@RequestBody Task task);
    
    @GetMapping("/task/poll/{type}/{priority}")
    public ResponseMessage poll(@PathVariable("type") Integer type, @PathVariable("priority") Integer priority);
    
    @PostMapping("/task/cancel")
    public ResponseMessage cancel(@RequestParam("taskId") Long taskId);


    @GetMapping("/task/refresh")
    public ResponseMessage refresh();
}
